package com.app.twth.ui;

import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;

import androidx.appcompat.app.AppCompatActivity;

import com.app.twth.R;
import com.app.twth.app.AppRouter;
import com.app.twth.app.Constant;
import com.app.twth.app.MyApplication;
import com.app.twth.slidingmenu.SlidingActivity;
import com.app.twth.ui.login.LoginActivity;
import com.app.twth.utils.PreferencesUtil;
import com.app.twth.utils.Utils;

public class WelcomeActivity extends AppCompatActivity {
    private String TAG = getClass().getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.e(TAG, "onCreate");
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.activity_welcome);

        if (Utils.isEmpty(MyApplication.token)) {
            MyApplication.token = PreferencesUtil.getString(this, Constant.token);
        }
        Log.e(TAG,"Build.MANUFACTURER:"+ Build.MANUFACTURER);
        if (Utils.isEmpty(MyApplication.token)) {
            AppRouter.showFragmentActivity(this, LoginActivity.class);
        } else {
            AppRouter.showFragmentActivity(this, SlidingActivity.class);
//            AppRouter.showFragmentActivity(this, MainActivity.class);
        }

        finish();
    }

}
